package com.example.controller;


import com.example.dao.UserDao;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserDao userDao;
    @PostMapping("deleteUserById")
    public boolean deleteUserById(long id){
        //调用mybatis-plus提供的删除方法
        int result = userDao.deleteById(id);
        if (result>0){
            return true;
        }else {
            return false;
        }
    }
    @GetMapping("getAllUser")
    public List<User> getAllUser(){
        //调用mybatis-plus提供的删除方法
        return userDao.selectList(null);
    }
}
